 Imports MySql.Data.MySqlClient 
 Imports System.Data.OleDb
Imports System.Data.SqlClient
 Imports System .Data .SqlServerCe 
 Imports System.Data.OracleClient 
Imports System.Data
Imports DTO
Public Class PHUHUYNHDao
Inherits AbstractDao
 #Region "New" 
 Public Sub New(ByVal connection As KetNoiDto)
 MyBase.New(connection)
 End Sub
 Public Sub New( ByVal IDPHUHUYNH As System.Int32, ByVal connection As KetNoiDto)
 MyBase.New("PHUHUYNH", "select * from PHUHUYNH where IDPHUHUYNH=" & IDPHUHUYNH & "", connection)
 End Sub
 #End Region 
 Public Sub Them(ByVal Dto As PHUHUYNHDto)
 Dim strsql As String
 strsql = "Insert into PHUHUYNH(TEN_CHA,NGHENGHIEP_CHA,SDT_CHA,DIACHI_CHA,TEN_ME,NGHENGHIEP_ME,SDT_ME,DIACHI_ME,NGUOITHAN,NGHENGHIE_PNGUOITHAN,SDT_NGUOITHAN,DIACHI_NGUOITHAN,TRANGTHAI,GHICHU) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 Dim cmd As New OleDbCommand(strsql, Ket_noi_access)
cmd.Parameters.Add("@TEN_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIEP_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@TEN_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIEP_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters("@TEN_CHA").Value = Dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = Dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = Dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = Dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = Dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = Dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = Dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = Dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = Dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = Dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = Dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = Dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New OleDbCommand(strsql, Ket_noi_access)
 Dto.IDPHUHUYNH = cmd.ExecuteScalar()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress
 strsql = "Insert into PHUHUYNH(TEN_CHA,NGHENGHIEP_CHA,SDT_CHA,DIACHI_CHA,TEN_ME,NGHENGHIEP_ME,SDT_ME,DIACHI_ME,NGUOITHAN,NGHENGHIE_PNGUOITHAN,SDT_NGUOITHAN,DIACHI_NGUOITHAN,TRANGTHAI,GHICHU) values (@TEN_CHA,@NGHENGHIEP_CHA,@SDT_CHA,@DIACHI_CHA,@TEN_ME,@NGHENGHIEP_ME,@SDT_ME,@DIACHI_ME,@NGUOITHAN,@NGHENGHIE_PNGUOITHAN,@SDT_NGUOITHAN,@DIACHI_NGUOITHAN,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlCommand(strsql, Ket_noi_sql)
cmd.Parameters.Add("@TEN_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIEP_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@TEN_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIEP_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters("@TEN_CHA").Value = Dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = Dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = Dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = Dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = Dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = Dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = Dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = Dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = Dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = Dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = Dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = Dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New sqlCommand(strsql, Ket_noi_sql)
 Dto.IDPHUHUYNH = cmd.ExecuteScalar()
 Case Class_KieuDL.SqlCe
 strsql = "Insert into PHUHUYNH(TEN_CHA,NGHENGHIEP_CHA,SDT_CHA,DIACHI_CHA,TEN_ME,NGHENGHIEP_ME,SDT_ME,DIACHI_ME,NGUOITHAN,NGHENGHIE_PNGUOITHAN,SDT_NGUOITHAN,DIACHI_NGUOITHAN,TRANGTHAI,GHICHU) values (@TEN_CHA,@NGHENGHIEP_CHA,@SDT_CHA,@DIACHI_CHA,@TEN_ME,@NGHENGHIEP_ME,@SDT_ME,@DIACHI_ME,@NGUOITHAN,@NGHENGHIE_PNGUOITHAN,@SDT_NGUOITHAN,@DIACHI_NGUOITHAN,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlceCommand(strsql, Ket_noi_SqlCe)
cmd.Parameters("@TEN_CHA").Value = Dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = Dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = Dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = Dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = Dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = Dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = Dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = Dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = Dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = Dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = Dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = Dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strsql = "Insert into PHUHUYNH(TEN_CHA,NGHENGHIEP_CHA,SDT_CHA,DIACHI_CHA,TEN_ME,NGHENGHIEP_ME,SDT_ME,DIACHI_ME,NGUOITHAN,NGHENGHIE_PNGUOITHAN,SDT_NGUOITHAN,DIACHI_NGUOITHAN,TRANGTHAI,GHICHU) values (@TEN_CHA,@NGHENGHIEP_CHA,@SDT_CHA,@DIACHI_CHA,@TEN_ME,@NGHENGHIEP_ME,@SDT_ME,@DIACHI_ME,@NGUOITHAN,@NGHENGHIE_PNGUOITHAN,@SDT_NGUOITHAN,@DIACHI_NGUOITHAN,@TRANGTHAI,@GHICHU)
 Dim cmd As New OracleCommand(strsql, Ket_noi_Oracle)
cmd.Parameters("@TEN_CHA").Value = Dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = Dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = Dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = Dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = Dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = Dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = Dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = Dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = Dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = Dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = Dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = Dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Mysql
 strsql = "Insert into PHUHUYNH(TEN_CHA,NGHENGHIEP_CHA,SDT_CHA,DIACHI_CHA,TEN_ME,NGHENGHIEP_ME,SDT_ME,DIACHI_ME,NGUOITHAN,NGHENGHIE_PNGUOITHAN,SDT_NGUOITHAN,DIACHI_NGUOITHAN,TRANGTHAI,GHICHU) values (@TEN_CHA,@NGHENGHIEP_CHA,@SDT_CHA,@DIACHI_CHA,@TEN_ME,@NGHENGHIEP_ME,@SDT_ME,@DIACHI_ME,@NGUOITHAN,@NGHENGHIE_PNGUOITHAN,@SDT_NGUOITHAN,@DIACHI_NGUOITHAN,@TRANGTHAI,@GHICHU)
 Dim cmd As New MySqlCommand(strsql, Ket_noi_MySql)
cmd.Parameters.Add("@TEN_CHA", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIEP_CHA", MySqlDbType.String)
cmd.Parameters.Add("@SDT_CHA", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_CHA", MySqlDbType.String)
cmd.Parameters.Add("@TEN_ME", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIEP_ME", MySqlDbType.String)
cmd.Parameters.Add("@SDT_ME", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_ME", MySqlDbType.String)
cmd.Parameters.Add("@NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@SDT_NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters("@TEN_CHA").Value = Dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = Dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = Dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = Dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = Dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = Dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = Dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = Dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = Dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = Dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = Dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = Dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub Xoa( ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH= ? 
Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDPHUHUYNH",OleDbType.Integer).Value = IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH= @IDPHUHUYNH
Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDPHUHUYNH",SqlDbType.Int).value=IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH=" & IDPHUHUYNH & "
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH=" & IDPHUHUYNH & "
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH=" & IDPHUHUYNH & "
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub sua(ByVal dto As PHUHUYNHDto)
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set TEN_CHA=? ,NGHENGHIEP_CHA=? ,SDT_CHA=? ,DIACHI_CHA=? ,TEN_ME=? ,NGHENGHIEP_ME=? ,SDT_ME=? ,DIACHI_ME=? ,NGUOITHAN=? ,NGHENGHIE_PNGUOITHAN=? ,SDT_NGUOITHAN=? ,DIACHI_NGUOITHAN=? ,TRANGTHAI=? ,GHICHU= ? where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@TEN_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIEP_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_CHA", OleDbType.VarWChar)
cmd.Parameters.Add("@TEN_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIEP_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_ME", OleDbType.VarWChar)
cmd.Parameters.Add("@NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@SDT_NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", OleDbType.VarWChar)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
cmd.Parameters("@TEN_CHA").Value = dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHUHUYNH").Value = dto.IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set TEN_CHA= @TEN_CHA , NGHENGHIEP_CHA= @NGHENGHIEP_CHA , SDT_CHA= @SDT_CHA , DIACHI_CHA= @DIACHI_CHA , TEN_ME= @TEN_ME , NGHENGHIEP_ME= @NGHENGHIEP_ME , SDT_ME= @SDT_ME , DIACHI_ME= @DIACHI_ME , NGUOITHAN= @NGUOITHAN , NGHENGHIE_PNGUOITHAN= @NGHENGHIE_PNGUOITHAN , SDT_NGUOITHAN= @SDT_NGUOITHAN , DIACHI_NGUOITHAN= @DIACHI_NGUOITHAN , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@TEN_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIEP_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_CHA", SqlDbType.NVarChar)
cmd.Parameters.Add("@TEN_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIEP_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_ME", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@SDT_NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", SqlDbType.NVarChar)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
cmd.Parameters("@TEN_CHA").Value = dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHUHUYNH").Value = dto.IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set TEN_CHA= @TEN_CHA , NGHENGHIEP_CHA= @NGHENGHIEP_CHA , SDT_CHA= @SDT_CHA , DIACHI_CHA= @DIACHI_CHA , TEN_ME= @TEN_ME , NGHENGHIEP_ME= @NGHENGHIEP_ME , SDT_ME= @SDT_ME , DIACHI_ME= @DIACHI_ME , NGUOITHAN= @NGUOITHAN , NGHENGHIE_PNGUOITHAN= @NGHENGHIE_PNGUOITHAN , SDT_NGUOITHAN= @SDT_NGUOITHAN , DIACHI_NGUOITHAN= @DIACHI_NGUOITHAN , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
cmd.Parameters("@TEN_CHA").Value = dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHUHUYNH").Value = dto.IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set TEN_CHA= @TEN_CHA , NGHENGHIEP_CHA= @NGHENGHIEP_CHA , SDT_CHA= @SDT_CHA , DIACHI_CHA= @DIACHI_CHA , TEN_ME= @TEN_ME , NGHENGHIEP_ME= @NGHENGHIEP_ME , SDT_ME= @SDT_ME , DIACHI_ME= @DIACHI_ME , NGUOITHAN= @NGUOITHAN , NGHENGHIE_PNGUOITHAN= @NGHENGHIE_PNGUOITHAN , SDT_NGUOITHAN= @SDT_NGUOITHAN , DIACHI_NGUOITHAN= @DIACHI_NGUOITHAN , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
cmd.Parameters("@TEN_CHA").Value = dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHUHUYNH").Value = dto.IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set TEN_CHA= @TEN_CHA , NGHENGHIEP_CHA= @NGHENGHIEP_CHA , SDT_CHA= @SDT_CHA , DIACHI_CHA= @DIACHI_CHA , TEN_ME= @TEN_ME , NGHENGHIEP_ME= @NGHENGHIEP_ME , SDT_ME= @SDT_ME , DIACHI_ME= @DIACHI_ME , NGUOITHAN= @NGUOITHAN , NGHENGHIE_PNGUOITHAN= @NGHENGHIE_PNGUOITHAN , SDT_NGUOITHAN= @SDT_NGUOITHAN , DIACHI_NGUOITHAN= @DIACHI_NGUOITHAN , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
cmd.Parameters.Add("@TEN_CHA", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIEP_CHA", MySqlDbType.String)
cmd.Parameters.Add("@SDT_CHA", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_CHA", MySqlDbType.String)
cmd.Parameters.Add("@TEN_ME", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIEP_ME", MySqlDbType.String)
cmd.Parameters.Add("@SDT_ME", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_ME", MySqlDbType.String)
cmd.Parameters.Add("@NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@SDT_NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@DIACHI_NGUOITHAN", MySqlDbType.String)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters.Add("@IDPHUHUYNH", MySqlDbType.Int32)
cmd.Parameters("@TEN_CHA").Value = dto.TEN_CHA
cmd.Parameters("@NGHENGHIEP_CHA").Value = dto.NGHENGHIEP_CHA
cmd.Parameters("@SDT_CHA").Value = dto.SDT_CHA
cmd.Parameters("@DIACHI_CHA").Value = dto.DIACHI_CHA
cmd.Parameters("@TEN_ME").Value = dto.TEN_ME
cmd.Parameters("@NGHENGHIEP_ME").Value = dto.NGHENGHIEP_ME
cmd.Parameters("@SDT_ME").Value = dto.SDT_ME
cmd.Parameters("@DIACHI_ME").Value = dto.DIACHI_ME
cmd.Parameters("@NGUOITHAN").Value = dto.NGUOITHAN
cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value = dto.NGHENGHIE_PNGUOITHAN
cmd.Parameters("@SDT_NGUOITHAN").Value = dto.SDT_NGUOITHAN
cmd.Parameters("@DIACHI_NGUOITHAN").Value = dto.DIACHI_NGUOITHAN
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHUHUYNH").Value = dto.IDPHUHUYNH
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub SuaTEN_CHA( ByVal TEN_CHA as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set TEN_CHA = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TEN_CHA", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@TEN_CHA").Value =  TEN_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set TEN_CHA = @TEN_CHA  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TEN_CHA", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@TEN_CHA").Value =  TEN_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set TEN_CHA =" & TEN_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set TEN_CHA =" & TEN_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set TEN_CHA =" & TEN_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaNGHENGHIEP_CHA( ByVal NGHENGHIEP_CHA as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_CHA = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@NGHENGHIEP_CHA", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@NGHENGHIEP_CHA").Value =  NGHENGHIEP_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_CHA = @NGHENGHIEP_CHA  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@NGHENGHIEP_CHA", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@NGHENGHIEP_CHA").Value =  NGHENGHIEP_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_CHA =" & NGHENGHIEP_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_CHA =" & NGHENGHIEP_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_CHA =" & NGHENGHIEP_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaSDT_CHA( ByVal SDT_CHA as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set SDT_CHA = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@SDT_CHA", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@SDT_CHA").Value =  SDT_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set SDT_CHA = @SDT_CHA  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@SDT_CHA", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@SDT_CHA").Value =  SDT_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set SDT_CHA =" & SDT_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set SDT_CHA =" & SDT_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set SDT_CHA =" & SDT_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaDIACHI_CHA( ByVal DIACHI_CHA as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set DIACHI_CHA = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@DIACHI_CHA", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@DIACHI_CHA").Value =  DIACHI_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set DIACHI_CHA = @DIACHI_CHA  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@DIACHI_CHA", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@DIACHI_CHA").Value =  DIACHI_CHA
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set DIACHI_CHA =" & DIACHI_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set DIACHI_CHA =" & DIACHI_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set DIACHI_CHA =" & DIACHI_CHA & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTEN_ME( ByVal TEN_ME as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set TEN_ME = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TEN_ME", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@TEN_ME").Value =  TEN_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set TEN_ME = @TEN_ME  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TEN_ME", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@TEN_ME").Value =  TEN_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set TEN_ME =" & TEN_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set TEN_ME =" & TEN_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set TEN_ME =" & TEN_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaNGHENGHIEP_ME( ByVal NGHENGHIEP_ME as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_ME = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@NGHENGHIEP_ME", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@NGHENGHIEP_ME").Value =  NGHENGHIEP_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_ME = @NGHENGHIEP_ME  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@NGHENGHIEP_ME", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@NGHENGHIEP_ME").Value =  NGHENGHIEP_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_ME =" & NGHENGHIEP_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_ME =" & NGHENGHIEP_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set NGHENGHIEP_ME =" & NGHENGHIEP_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaSDT_ME( ByVal SDT_ME as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set SDT_ME = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@SDT_ME", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@SDT_ME").Value =  SDT_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set SDT_ME = @SDT_ME  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@SDT_ME", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@SDT_ME").Value =  SDT_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set SDT_ME =" & SDT_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set SDT_ME =" & SDT_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set SDT_ME =" & SDT_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaDIACHI_ME( ByVal DIACHI_ME as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set DIACHI_ME = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@DIACHI_ME", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@DIACHI_ME").Value =  DIACHI_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set DIACHI_ME = @DIACHI_ME  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@DIACHI_ME", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@DIACHI_ME").Value =  DIACHI_ME
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set DIACHI_ME =" & DIACHI_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set DIACHI_ME =" & DIACHI_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set DIACHI_ME =" & DIACHI_ME & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaNGUOITHAN( ByVal NGUOITHAN as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set NGUOITHAN = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@NGUOITHAN", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@NGUOITHAN").Value =  NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set NGUOITHAN = @NGUOITHAN  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@NGUOITHAN", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@NGUOITHAN").Value =  NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set NGUOITHAN =" & NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set NGUOITHAN =" & NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set NGUOITHAN =" & NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaNGHENGHIE_PNGUOITHAN( ByVal NGHENGHIE_PNGUOITHAN as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set NGHENGHIE_PNGUOITHAN = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value =  NGHENGHIE_PNGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set NGHENGHIE_PNGUOITHAN = @NGHENGHIE_PNGUOITHAN  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@NGHENGHIE_PNGUOITHAN", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@NGHENGHIE_PNGUOITHAN").Value =  NGHENGHIE_PNGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set NGHENGHIE_PNGUOITHAN =" & NGHENGHIE_PNGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set NGHENGHIE_PNGUOITHAN =" & NGHENGHIE_PNGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set NGHENGHIE_PNGUOITHAN =" & NGHENGHIE_PNGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaSDT_NGUOITHAN( ByVal SDT_NGUOITHAN as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set SDT_NGUOITHAN = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@SDT_NGUOITHAN", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@SDT_NGUOITHAN").Value =  SDT_NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set SDT_NGUOITHAN = @SDT_NGUOITHAN  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@SDT_NGUOITHAN", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@SDT_NGUOITHAN").Value =  SDT_NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set SDT_NGUOITHAN =" & SDT_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set SDT_NGUOITHAN =" & SDT_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set SDT_NGUOITHAN =" & SDT_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaDIACHI_NGUOITHAN( ByVal DIACHI_NGUOITHAN as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set DIACHI_NGUOITHAN = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@DIACHI_NGUOITHAN", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@DIACHI_NGUOITHAN").Value =  DIACHI_NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set DIACHI_NGUOITHAN = @DIACHI_NGUOITHAN  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@DIACHI_NGUOITHAN", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@DIACHI_NGUOITHAN").Value =  DIACHI_NGUOITHAN
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set DIACHI_NGUOITHAN =" & DIACHI_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set DIACHI_NGUOITHAN =" & DIACHI_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set DIACHI_NGUOITHAN =" & DIACHI_NGUOITHAN & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set TRANGTHAI = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set TRANGTHAI = @TRANGTHAI  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set TRANGTHAI =" & TRANGTHAI & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set TRANGTHAI =" & TRANGTHAI & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set TRANGTHAI =" & TRANGTHAI & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaGHICHU( ByVal GHICHU as System.String, ByVal IDPHUHUYNH As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHUHUYNH Set GHICHU = ?  where IDPHUHUYNH= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHUHUYNH", OleDbType.Integer)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHUHUYNH Set GHICHU = @GHICHU  where IDPHUHUYNH= @IDPHUHUYNH"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHUHUYNH", SqlDbType.Int)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDPHUHUYNH").Value =  IDPHUHUYNH
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHUHUYNH Set GHICHU =" & GHICHU & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHUHUYNH Set GHICHU =" & GHICHU & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHUHUYNH Set GHICHU =" & GHICHU & "  where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub layBang()
 Chuoi_SQL = " Select * from PHUHUYNH
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDPHUHUYNH(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDPHUHUYNH=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDPHUHUYNH(ByVal IDPHUHUYNH As System.Int32 )
 Chuoi_SQL = " Select * from PHUHUYNH where  IDPHUHUYNH = " & IDPHUHUYNH & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDPHUHUYNH(ByVal IDPHUHUYNH As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where IDPHUHUYNH=" & IDPHUHUYNH & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTEN_CHA(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TEN_CHA='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTEN_CHA_like (ByVal TEN_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  TEN_CHA  like '%" & TEN_CHA & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoTEN_CHA(ByVal TEN_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  TEN_CHA = '" & TEN_CHA & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTEN_CHA(ByVal TEN_CHA As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where TEN_CHA='" & TEN_CHA & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoNGHENGHIEP_CHA(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "NGHENGHIEP_CHA='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIEP_CHA_like (ByVal NGHENGHIEP_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIEP_CHA  like '%" & NGHENGHIEP_CHA & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIEP_CHA(ByVal NGHENGHIEP_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIEP_CHA = '" & NGHENGHIEP_CHA & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoNGHENGHIEP_CHA(ByVal NGHENGHIEP_CHA As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where NGHENGHIEP_CHA='" & NGHENGHIEP_CHA & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoSDT_CHA(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "SDT_CHA='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_CHA_like (ByVal SDT_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_CHA  like '%" & SDT_CHA & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_CHA(ByVal SDT_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_CHA = '" & SDT_CHA & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoSDT_CHA(ByVal SDT_CHA As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where SDT_CHA='" & SDT_CHA & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoDIACHI_CHA(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "DIACHI_CHA='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_CHA_like (ByVal DIACHI_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_CHA  like '%" & DIACHI_CHA & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_CHA(ByVal DIACHI_CHA As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_CHA = '" & DIACHI_CHA & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoDIACHI_CHA(ByVal DIACHI_CHA As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where DIACHI_CHA='" & DIACHI_CHA & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTEN_ME(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TEN_ME='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTEN_ME_like (ByVal TEN_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  TEN_ME  like '%" & TEN_ME & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoTEN_ME(ByVal TEN_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  TEN_ME = '" & TEN_ME & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTEN_ME(ByVal TEN_ME As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where TEN_ME='" & TEN_ME & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoNGHENGHIEP_ME(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "NGHENGHIEP_ME='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIEP_ME_like (ByVal NGHENGHIEP_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIEP_ME  like '%" & NGHENGHIEP_ME & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIEP_ME(ByVal NGHENGHIEP_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIEP_ME = '" & NGHENGHIEP_ME & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoNGHENGHIEP_ME(ByVal NGHENGHIEP_ME As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where NGHENGHIEP_ME='" & NGHENGHIEP_ME & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoSDT_ME(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "SDT_ME='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_ME_like (ByVal SDT_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_ME  like '%" & SDT_ME & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_ME(ByVal SDT_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_ME = '" & SDT_ME & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoSDT_ME(ByVal SDT_ME As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where SDT_ME='" & SDT_ME & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoDIACHI_ME(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "DIACHI_ME='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_ME_like (ByVal DIACHI_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_ME  like '%" & DIACHI_ME & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_ME(ByVal DIACHI_ME As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_ME = '" & DIACHI_ME & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoDIACHI_ME(ByVal DIACHI_ME As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where DIACHI_ME='" & DIACHI_ME & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoNGUOITHAN(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "NGUOITHAN='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGUOITHAN_like (ByVal NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGUOITHAN  like '%" & NGUOITHAN & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGUOITHAN(ByVal NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGUOITHAN = '" & NGUOITHAN & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoNGUOITHAN(ByVal NGUOITHAN As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where NGUOITHAN='" & NGUOITHAN & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoNGHENGHIE_PNGUOITHAN(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "NGHENGHIE_PNGUOITHAN='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIE_PNGUOITHAN_like (ByVal NGHENGHIE_PNGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIE_PNGUOITHAN  like '%" & NGHENGHIE_PNGUOITHAN & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoNGHENGHIE_PNGUOITHAN(ByVal NGHENGHIE_PNGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  NGHENGHIE_PNGUOITHAN = '" & NGHENGHIE_PNGUOITHAN & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoNGHENGHIE_PNGUOITHAN(ByVal NGHENGHIE_PNGUOITHAN As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where NGHENGHIE_PNGUOITHAN='" & NGHENGHIE_PNGUOITHAN & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoSDT_NGUOITHAN(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "SDT_NGUOITHAN='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_NGUOITHAN_like (ByVal SDT_NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_NGUOITHAN  like '%" & SDT_NGUOITHAN & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoSDT_NGUOITHAN(ByVal SDT_NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  SDT_NGUOITHAN = '" & SDT_NGUOITHAN & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoSDT_NGUOITHAN(ByVal SDT_NGUOITHAN As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where SDT_NGUOITHAN='" & SDT_NGUOITHAN & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoDIACHI_NGUOITHAN(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "DIACHI_NGUOITHAN='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_NGUOITHAN_like (ByVal DIACHI_NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_NGUOITHAN  like '%" & DIACHI_NGUOITHAN & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIACHI_NGUOITHAN(ByVal DIACHI_NGUOITHAN As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  DIACHI_NGUOITHAN = '" & DIACHI_NGUOITHAN & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoDIACHI_NGUOITHAN(ByVal DIACHI_NGUOITHAN As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where DIACHI_NGUOITHAN='" & DIACHI_NGUOITHAN & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TRANGTHAI=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32 )
 Chuoi_SQL = " Select * from PHUHUYNH where  TRANGTHAI = " & TRANGTHAI & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where TRANGTHAI=" & TRANGTHAI & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoGHICHU(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "GHICHU='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHUHUYNH" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU_like (ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  GHICHU  like '%" & GHICHU & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU(ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from PHUHUYNH where  GHICHU = '" & GHICHU & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoGHICHU(ByVal GHICHU As System.String)
 Dim strsql As String
 strSQL = "Delete From PHUHUYNH Where GHICHU='" & GHICHU & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangNhieuTable
 Chuoi_SQL = " Select IDPHUHUYNH ,TEN.CHA as TEN_CHA ,NGHENGHIEP.CHA as NGHENGHIEP_CHA ,SDT.CHA as SDT_CHA ,DIACHI.CHA as DIACHI_CHA ,TEN.ME as TEN_ME ,NGHENGHIEP.ME as NGHENGHIEP_ME ,SDT.ME as SDT_ME ,DIACHI.ME as DIACHI_ME ,PHUHUYNH.NGUOITHAN as PHUHUYNH_NGUOITHAN ,NGHENGHIE.PNGUOITHAN as NGHENGHIE_PNGUOITHAN ,SDT.NGUOITHAN as SDT_NGUOITHAN ,DIACHI.NGUOITHAN as DIACHI_NGUOITHAN ,TRANGTHAI ,GHICHU  from PHUHUYNH"
 Doc_bang()
 End sub
Public Sub TaoTable()
Dim strsql As String
strsql = ""
Select Case ketnoi.MsSql
Case Class_KieuDL.Access 
Case Class_KieuDL.Sql, Class_KieuDL.sqlExpress
strsql = ""
Case Class_KieuDL.SqlCe
strsql = ""
Case Class_KieuDL.Oracle
strsql = ""
Case else 
strsql = ""
End Select
Thuc_hien_lenh(strsql)
End Sub
 End Class

